package com.imooc.util;

import com.imooc.domain.Result;
import com.imooc.enums.ResultEnum;

/**
 * @author songjun
 * @date 2019/7/24.
 */
public final class ResultUtil {

    public static Result success(Object o) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getCode());
        result.setMsg(ResultEnum.SUCCESS.getMsg());
        result.setData(o);
        return result;
    }

    public static Result error(ResultEnum resultEnum) {
        Result result = new Result();
        result.setCode(resultEnum.getCode());
        result.setMsg(resultEnum.getMsg());
        return result;
    }
}
